<?php if(!defined('ROOT_PATH')) exit('Access Denied');?><div id="comments">
<div id="comment">
 <div id="commentlist">
        <div class="f-s"></div>
        <div class="f-m">
          <h2> <em>评论</em> <span class="thin"><?php echo $count;?>条</span> <span class="thin"> (<a href="<?php echo APP;?>index.php/Index/Feed" title="RSS" target="_self" title="">RSS 2.0</a>)</span> <a href="##respond" class="to_respond">发表</a> </h2>
          <div class="commentbox">
          <?php if($commentdata == null) { ?>&nbsp;&nbsp;这篇文章还没人评论，大家来沙发呀！<?php } ?>
          <?php if(is_array($commentdata)) foreach($commentdata AS $vlaue) { ?>
          <li class="comment_li">
               <div class="comment-body">
                <div class="vcard"> <img  class="avatar"  src="<?php if($vlaue["head"] != null) { ?><?php echo $vlaue["head"];?><?php } else { ?><?php echo APP;?>themes/default/images/nopic.png<?php } ?>" alt="头像"/> <cite class="fn"><a class="url" title="<?php echo $vlaue["name"];?>" href="" target="_blank"><?php echo $vlaue["name"];?></a> </cite> <span class="says">说：</span> </div>
                <div class="comment-meta"> <a href=""><?php echo $vlaue["date"];?></a> </div>
                <p><?php echo ubb($vlaue["content"]);?></p>
                <div class="reply"><a class="comment-reply-link" href="#respond" onclick="re(<?php echo $vlaue["id"];?>)" rel="nofollow" title="">回复</a></div>
              </div>
            </li>
          <?php } ?>

<!--         <?php if(is_array($alldata)) foreach($alldata AS $vlaue) { ?>
         <?php if($vlaue["re"]==0) { ?>
          <li class="comment_li">
          <?php } else { ?>
          <ul class='children'>
          <li class="comment">
          <?php } ?>
               <div class="comment-body">
                <div class="vcard"> <img  class="avatar"  src="<?php if($vlaue["head"] != null) { ?><?php echo $vlaue["head"];?><?php } else { ?><?php echo APP;?>themes/default/images/nopic.png<?php } ?>" alt="头像"/> <cite class="fn"><a class="url" title="<?php echo $vlaue["name"];?>" href="" target="_blank"><?php echo $vlaue["name"];?></a> </cite> <span class="says">说：</span> </div>
                <div class="comment-meta"> <a href=""><?php echo $vlaue["date"];?></a> </div>
                <p><?php echo $vlaue["content"];?></p>
                <div class="reply"><?php if($vlaue["re"]==0) { ?>
          <a class="comment-reply-link" href="#respond" onclick="re(<?php echo $vlaue["id"];?>)" rel="nofollow" title="">回复</a>
          <?php } else { ?> &nbsp; 
          <?php } ?></div>
              </div>
          <?php if($vlaue["re"]==0) { ?>
          </li>
          <?php } else { ?>
          </li>
          </ul>
          <?php } ?>
         <?php } ?>
-->
         <?php if($page["total_count"]>0) { ?><!--分页开始-->
            <ul class="pagination">
              <div>
                <table width="100%" border="0" cellpadding="5" cellspacing="0">
                  <tr>
                    <td valign="bottom" align="left" nowrap="true" style="width:40%;">总记录: <?php echo $page["total_count"];?>  页码:<?php echo $page["current_page"];?>/<?php echo $page["total_page"];?>  每页：<?php echo $page["page_size"];?></td>
                    <td valign="bottom" align="right" nowrap="true" class="" style="width:60%;">
                    <?php if($page["current_page"] != $page["first_page"]) { ?>
                    <a disabled="true" style="margin-right:5px;" onclick="ajaxLoad('<?php echo APP;?>index.php/Comments/Main/aid/<?php echo $aid;?>/p/<?php echo $page["first_page"];?>','#comments');return false;">首页</a>
                    <a disabled="true" style="margin-right:5px;" onclick="ajaxLoad('<?php echo APP;?>index.php/Comments/Main/aid/<?php echo $aid;?>/p/<?php echo $page["prev_page"];?>','#comments');return false;">上一页</a><?php } ?>
                    <?php if(is_array($page["all_pages"])) foreach($page["all_pages"] AS $vlaue) { ?>
                    <?php if($vlaue != $page["current_page"]) { ?>
                    <a style="margin-right:5px;font-weight:Bold;color:black;" href="" onclick="ajaxLoad('<?php echo APP;?>index.php/Comments/Main/aid/<?php echo $aid;?>/p/<?php echo $vlaue;?>','#comments');return false;"><?php echo $vlaue;?></a>
                    <?php } else { ?>
                    <span style="margin-right:5px;font-weight:Bold;color:red;"><?php echo $vlaue;?></span>
                    <?php } ?>
                    <?php } ?>

                    <?php if($page["current_page"] != $page["last_page"]) { ?>
                    <a disabled="true" style="margin-right:5px;" onclick="ajaxLoad('<?php echo APP;?>index.php/Comments/Main/aid/<?php echo $aid;?>/p/<?php echo $page["next_page"];?>','#comments');return false;">下一页</a>
                    <a disabled="true" style="margin-right:5px;" onclick="ajaxLoad('<?php echo APP;?>index.php/Comments/Main/aid/<?php echo $aid;?>/p/<?php echo $page["last_page"];?>','#comments');return false;">尾页</a></td>
                    <?php } ?>
                   
                   
                  </tr>
                </table>
              </div>
            </ul>
         <?php } ?><!--分页结束-->
          </div>
        </div>
        <div class="f-e"></div>
      </div>
</div>
<div id="respond">
        <div class="f-s"></div>
        <div class="f-m">
          <h2> <em>文章评论</em> <span class="thin">(欢迎发积极评论，严禁不文明用语、广告...)</span> </h2>
          <div class="box">
            <ul id="respond-form">
              <form action="<?php echo APP;?>index.php/Comments/Add" method="post" id="commentform">
                <li>
                  <label for="name">名称 (必填)</label>
                  <input type="text" id="name" name="name" value="" maxlength="12" />
                </li>
                <li>
                  <label for="email">电子邮件(不会被公开)</label>
                  <input type="text" name="email" id="email" value="" />
                </li>
                <li>
                  <label for="web">网站</label>
                  <input type="text" name="web" id="web" value="http://" />
                </li>
                <li class="spic"> 
                  <script type="text/javascript" language="javascript">
/* <![CDATA[ */
    function grin(tag) {
    	var myField;
    	tag = ' ' + tag + ' ';
        if (document.getElementById('comcontent') && document.getElementById('comcontent').type == 'textarea') {
    		myField = document.getElementById('comcontent');
    	} else {
    		return false;
    	}
    	if (document.selection) {
    		myField.focus();
    		sel = document.selection.createRange();
    		sel.text = tag;
    		myField.focus();
    	}
    	else if (myField.selectionStart || myField.selectionStart == '0') {
    		var startPos = myField.selectionStart;
    		var endPos = myField.selectionEnd;
    		var cursorPos = endPos;
    		myField.value = myField.value.substring(0, startPos)
    					  + tag
    					  + myField.value.substring(endPos, myField.value.length);
    		cursorPos += tag.length;
    		myField.focus();
    		myField.selectionStart = cursorPos;
    		myField.selectionEnd = cursorPos;
    	}
    	else {
    		myField.value += tag;
    		myField.focus();
    	}
    }
/* ]]> */
</script> <a href="javascript:grin(':?:')"><img src="<?php echo APP;?>themes/default/smilies/icon_question.gif" alt="" /></a> <a href="javascript:grin(':razz:')"><img src="<?php echo APP;?>themes/default/smilies/icon_razz.gif" alt="" /></a> <a href="javascript:grin(':sad:')"><img src="<?php echo APP;?>themes/default/smilies/icon_sad.gif" alt="" /></a> <a href="javascript:grin(':evil:')"><img src="<?php echo APP;?>themes/default/smilies/icon_evil.gif" alt="" /></a> <a href="javascript:grin(':!:')"><img src="<?php echo APP;?>themes/default/smilies/icon_exclaim.gif" alt="" /></a> <a href="javascript:grin(':smile:')"><img src="<?php echo APP;?>themes/default/smilies/icon_smile.gif" alt="" /></a> <a href="javascript:grin(':oops:')"><img src="<?php echo APP;?>themes/default/smilies/icon_redface.gif" alt="" /></a> <a href="javascript:grin(':shock:')"><img src="<?php echo APP;?>themes/default/smilies/icon_eek.gif" alt="" /></a> <a href="javascript:grin(':???:')"><img src="<?php echo APP;?>themes/default/smilies/icon_confused.gif" alt="" /></a> <a href="javascript:grin(':cool:')"><img src="<?php echo APP;?>themes/default/smilies/icon_cool.gif" alt="" /></a> <a href="javascript:grin(':lol:')"><img src="<?php echo APP;?>themes/default/smilies/icon_lol.gif" alt="" /></a> <a href="javascript:grin(':mad:')"><img src="<?php echo APP;?>themes/default/smilies/icon_mad.gif" alt="" /></a> <a href="javascript:grin(':twisted:')"><img src="<?php echo APP;?>themes/default/smilies/icon_twisted.gif" alt="" /></a> <a href="javascript:grin(':roll:')"><img src="<?php echo APP;?>themes/default/smilies/icon_rolleyes.gif" alt="" /></a> <a href="javascript:grin(':wink:')"><img src="<?php echo APP;?>themes/default/smilies/icon_wink.gif" alt="" /></a> <a href="javascript:grin(':idea:')"><img src="<?php echo APP;?>themes/default/smilies/icon_idea.gif" alt="" /></a> <a href="javascript:grin(':arrow:')"><img src="<?php echo APP;?>themes/default/smilies/icon_arrow.gif" alt="" /></a> <a href="javascript:grin(':neutral:')"><img src="<?php echo APP;?>themes/default/smilies/icon_neutral.gif" alt="" /></a> <a href="javascript:grin(':cry:')"><img src="<?php echo APP;?>themes/default/smilies/icon_cry.gif" alt="" /></a> <a href="javascript:grin(':s1:')"><img src="<?php echo APP;?>themes/default/smilies/s1.gif" alt="" /></a> <a href="javascript:grin(':s2:')"><img src="<?php echo APP;?>themes/default/smilies/s2.gif" alt="" /></a> <a href="javascript:grin(':s3:')"><img src="<?php echo APP;?>themes/default/smilies/s3.gif" alt="" /></a> <a href="javascript:grin(':s4:')"><img src="<?php echo APP;?>themes/default/smilies/s4.gif" alt="" /></a> <a href="javascript:grin(':s5:')"><img src="<?php echo APP;?>themes/default/smilies/s5.gif" alt="" /></a> <a href="javascript:grin(':s6:')"><img src="<?php echo APP;?>themes/default/smilies/s6.gif" alt="" /></a> <a href="javascript:grin(':s7:')"><img src="<?php echo APP;?>themes/default/smilies/s7.gif" alt="" /></a> </li>
                <li>
                  <textarea id="comcontent" name="comcontent"></textarea>
                </li>
                <li class="form-post"> <span class="btn"><span>
                  <input type="hidden" id="rehidden" name="re" value="" />
                  <input type="hidden" id="aid" name="aid" value="<?php echo $aid;?>" />
                  <button type="submit" name="submit" id="commentSubmit">提交响应</button>
                  </span></span> <span class="btn"><span>
                  <button type="reset">重置</button>
                  </span></span> <span class="btn cancel"><span>
                  <button type="button" id="cancel-comment-reply-link">取消回复</button>
                  </span></span> </li>
              </form>
<script type="text/javascript" language="javascript">
function re(reid){
$('#rehidden').attr("value",reid); ;
}
/* <![CDATA[ */
$(document).ready(function(){

$('#commentform').ajaxForm({
success: function(data){

if(data=='ok!') {
alert('添加成功！');
$('#leaveform').resetForm();
ajaxLoad('<?php echo APP;?>index.php/Comments/Main/aid/<?php echo $aid;?>','#comments');	
} else {
alert('添加失败！');
}
}});


})
/* ]]> */
</script> 
            </ul>
          </div>
        </div>
        <div class="f-e"></div>
      </div>
</div>
  
